﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NGDTConsole.Data.Parameters;
using NGDTConsole.Data.Enumerations;

namespace NGDTConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            //test the longitude and latitude properties
            Longitude theta = new Longitude(12, 13, 50.125);
            Latitude lambda = new Latitude(9, 19, 9.051);
            double height = 268.127;
            GeodeticCoordinate geoPoint = new GeodeticCoordinate();
            geoPoint.Height = height;
            geoPoint.Longitude = theta;
            geoPoint.Latitude = lambda;

            
            TestAlgorithm test = new TestAlgorithm();
            Console.WriteLine("X  = {0}", test.CartesianX());
            Console.ReadKey();
            

            Ellipsoid ellipsoid = new Ellipsoid(GeodeticMeasurementUnits.DecimalDegree, 6378249.145, 0.003407546284, geoPoint.Latitude.LatitudeDegreeDecimal, 0, 4);
            //ellipsoid.MajorAxis = 6378249.145;
            //ellipsoid.RefEccentricity = 0.003407546284;
            //ellipsoid.MinorAxis = 0.4567821;
            //ellipsoid.RadiusOfCurvaturePrimeVertical = 6378253.017;
            
            CoordinateSystem.CoordinateConversion conversion = new CoordinateSystem.CoordinateConversion();
            CartesianCoordinate coordinate = conversion.CartesianCoordinateConversion(geoPoint, ellipsoid, 10);
            Console.WriteLine("Major Axis = {0}", ellipsoid.MajorAxis);
            Console.WriteLine("Minor Axis = {0}", ellipsoid.MinorAxis);
            Console.WriteLine("Prime Vertical = {0}", ellipsoid.PrimeVertical);
            Console.WriteLine("Flattening = {0}", ellipsoid.Flattening);
            Console.WriteLine("Inverse Flattening = {0}", ellipsoid.InverseFlattening);
            Console.WriteLine("Radius of Curvature Meridian= {0}", ellipsoid.MeridianCurvature);
            Console.WriteLine("Reference Eccentricity = {0}", ellipsoid.Eccentricity);
            Console.WriteLine("Second Reference Eccentricity = {0}", ellipsoid.SecondEccentricity);
            Console.WriteLine("Latitude = {0}", geoPoint.Latitude.LatitudeDegreeDecimal);
            Console.WriteLine("Longitude = {0}", geoPoint.Longitude.LongitudeDegreeDecimal);
            Console.WriteLine("Height = {0}", geoPoint.Height);
            Console.WriteLine("X = {0}", coordinate.CartesianX);
            Console.WriteLine("Y = {0}", coordinate.CartesianY);
            Console.WriteLine("Z = {0}", coordinate.CartesianZ);
            Console.ReadKey();

            //convert cartesian to curvilinear            
            GeodeticCoordinate curvilinear = conversion.CurvilinearCoordinateConversion(coordinate, ellipsoid, 10);
            Console.WriteLine("Longitude {0}", curvilinear.Longitude.LongitudeDegreeDecimal);
            Console.WriteLine("Latitude {0}", curvilinear.Latitude.LatitudeDegreeDecimal);
            Console.WriteLine("Height {0}", curvilinear.Height);
            Console.ReadKey();
            
            /*
            CoordinateSystem.CoordinateConversion conversion = new CoordinateSystem.CoordinateConversion();
            double[] coordinate = (double[])conversion.CartesianCoordinateConversion(geoPoint, ellipsoid);
            Console.WriteLine("X = {0}", coordinate[0]);
            Console.WriteLine("Y = {0}", coordinate[1]);
            Console.WriteLine("Z = {0}", coordinate[2]);
             * 
             */
        }
    }
}
